home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmMedia
- BorderStyle = 1 'Fixed Single
- Caption = "The Media Program"
- ClientHeight = 1425
- ClientLeft = 1095
- ClientTop = 1830
- ClientWidth = 6585
- Height = 2115
- Icon = "MEDIA.frx":0000
- Left = 1035
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 1425
- ScaleWidth = 6585
- Top = 1200
- Width = 6705
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 0
- Top = 0
- _Version = 65536
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- CancelError = -1 'True
- End
- Begin TegommLibCtl.Tegomm Tegomm1
- Height = 1455
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 6615
- _version = 65536
- _extentx = 11668
- _extenty = 2566
- _stockprops = 64
- updateinterval = 1000
- bevelwidth = 9
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuOpenWav
- Caption = "Open &WAV File..."
- End
- Begin VB.Menu mnuOpenMidi
- Caption = "Open &MIDI File..."
- End
- Begin VB.Menu mnuOpenAvi
- Caption = "Open &AVI Video File..."
- End
- Begin VB.Menu mnuOpenCDAudio
- Caption = "Open &CD Audio"
- End
- Begin VB.Menu mnuSep1
- Caption = "-"
- End
- Begin VB.Menu mnuExit
- Caption = "E&xit"
- End
- End
- Begin VB.Menu mnuHelp
- Caption = "&Help"
- Begin VB.Menu mnuAbout
- Caption = "&About..."
- End
- End
- Attribute VB_Name = "frmMedia"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- ' All variables must be declared.
- Option Explicit
- Private Sub mnuAbout_Click()
- Dim Title
- Dim Msg
- Dim CR
- CR = Chr(13)
- Title = "About the Media Program"
- Msg = "This program was written with Visual "
- Msg = Msg + "Basic for Windows, using the "
- Msg = Msg + "TegoSoft Multimedia OCX control. "
- Msg = Msg + CR + CR
- Msg = Msg + "The TegoSoft Multimedia OCX control "
- Msg = Msg + "is part of the TegoSoft OCX Control "
- Msg = Msg + "Kit - a collection of various OCX controls. "
- Msg = Msg + CR + CR
- Msg = Msg + "For more information about the "
- Msg = Msg + "TegoSoft OCX Control Kit, contact TegoSoft "
- Msg = Msg + "at:"
- Msg = Msg + CR + CR
- Msg = Msg + "TegoSoft Inc." + CR
- Msg = Msg + "P.O. Box 389" + CR
- Msg = Msg + "Bellmore, NY 11710"
- Msg = Msg + CR + CR
- Msg = Msg + "Phone: (516)783-4824"
- MsgBox Msg, vbInformation, Title
- End Sub
- Private Sub mnuExit_Click()
- Unload Me
- End Sub
- Private Sub mnuOpenAvi_Click()
- Dim Message
- ' Set the File Type list box of the common
- ' dialog.
- CommonDialog1.Filter = _
- "All Files (*.*)|*.*|Avi Video Files (*.avi)|*.avi"
-
- ' Set default File Type to WAV Files (*.wav).
- CommonDialog1.FilterIndex = 2
- ' Set an error trap.
- On Error GoTo OpenAviError
- ' Display the Open File dialog box.
- CommonDialog1.Action = 1
- ' Remove the error trap.
- On Error GoTo 0
- ' Open the selected WAV file.
- Tegomm1.DeviceType = "AviVideo"
- Tegomm1.filename = CommonDialog1.filename
- Tegomm1.Command = "Open"
- ' Check if file was opened successfully.
- If Tegomm1.Error > 0 Then
- Message = "Cannot open " + Tegomm1.filename
- MsgBox Message, vbExclamation, "ERROR"
- Me.Caption = "The Multimedia Program"
- Exit Sub
- End If
- ' Set the caption of the form to the name
- ' of the AVI file.
- Me.Caption = "The Media Program - " + CommonDialog1.FileTitle
-
- ' Exit this procedure.
- Exit Sub
- OpenAviError:
- ' The user clicked the Cancel button of the
- ' File Open dialog box.
- Exit Sub
- End Sub
- Private Sub mnuOpenCDAudio_Click()
- Dim Message
- ' Open the CD Audio device.
- Tegomm1.DeviceType = "CDAudio"
- Tegomm1.Command = "Open"
- ' Check if device was opened successfully.
- If Tegomm1.Error > 0 Then
- Message = "Cannot open the CD Audio device."
- MsgBox Message, vbExclamation, "ERROR"
- Me.Caption = "The Media Program"
- Tegomm1.DeviceType = ""
- Exit Sub
- End If
- ' Set the TimeFormat property of the multimedia control
- ' to TMSF. From now on, the Position and Length properties
- ' of the multimedia control will report values in units
- ' of tracks.
- Tegomm1.TimeFormat = "TMSF"
- ' Update the program's window title.
- Me.Caption = "The Media Program - Track " + Str(Tegomm1.Position)
- End Sub
- Private Sub mnuOpenMidi_Click()
- Dim Message
- ' Set the File Type list box of the common
- ' dialog.
- CommonDialog1.Filter = _
- "All Files (*.*)|*.*|Midi Files (*.mid)|*.mid"
-
- ' Set default File Type to MID Files (*.mid).
- CommonDialog1.FilterIndex = 2
- ' Set an error trap.
- On Error GoTo OpenMidiError
- ' Display the Open File dialog box.
- CommonDialog1.Action = 1
- ' Remove the error trap.
- On Error GoTo 0
- ' Open the selected MIDI file.
- Tegomm1.DeviceType = "Sequencer"
- Tegomm1.filename = CommonDialog1.filename
- Tegomm1.Command = "Open"
- ' Check if file was opened successfully.
- If Tegomm1.Error > 0 Then
- Message = "Cannot open " + Tegomm1.filename
- MsgBox Message, vbExclamation, "ERROR"
- Me.Caption = "The Multimedia Program"
- Exit Sub
- End If
- ' Set the caption of the form to the name
- ' of the MIDI file.
- Me.Caption = "The Media Program - " + CommonDialog1.FileTitle
- ' Exit this procedure.
- Exit Sub
- OpenMidiError:
- ' The user clicked the Cancel button of the
- ' File Open dialog box.
- Exit Sub
- End Sub
- Private Sub mnuOpenWav_Click()
- Dim Message
- ' Set the File Type list box of the common
- ' dialog.
- CommonDialog1.Filter = _
- "All Files (*.*)|*.*|Wav Files (*.wav)|*.wav"
-
- ' Set default File Type to WAV Files (*.wav).
- CommonDialog1.FilterIndex = 2
- ' Set an error trap.
- On Error GoTo OpenWavError
- ' Display the Open File dialog box.
- CommonDialog1.Action = 1
- ' Remove the error trap.
- On Error GoTo 0
- ' Open the selected WAV file.
- Tegomm1.DeviceType = "WaveAudio"
- Tegomm1.filename = CommonDialog1.filename
- Tegomm1.Command = "Open"
- ' Check if file was opened successfully.
- If Tegomm1.Error > 0 Then
- Message = "Cannot open " + Tegomm1.filename
- MsgBox Message, vbExclamation, "ERROR"
- Me.Caption = "The Multimedia Program"
- Exit Sub
- End If
- ' Set the caption of the form to the name
- ' of the WAV file.
- Me.Caption = "The Media Program - " + CommonDialog1.FileTitle
- ' Exit this procedure.
- Exit Sub
- OpenWavError:
- ' The user clicked the Cancel button of the
- ' File Open dialog box.
- Exit Sub
- End Sub
- Private Sub Tegomm1_Done()
- ' If playback position reached end of file, rewind
- ' the playback position.
- If Tegomm1.Position = Tegomm1.Length Then
- Tegomm1.Command = "Prev"
- End If
- End Sub
- Private Sub Tegomm1_StatusUpdate()
- Static OldPosition
- ' If the device is not CD Audio, terminate
- ' this procedure.
- If Tegomm1.DeviceType <> "CDAUDIO" Then
- Exit Sub
- End If
- ' If track has changed, update the program's
- ' window caption.
- If Tegomm1.Position <> OldPosition Then
- Me.Caption = "The Media Program - Track " + Str(Tegomm1.Position)
- OldPosition = Tegomm1.Position
- End If
- End Sub
-